<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Hard
  </div>
  <div>
   <h1 class="question_title">
    42. Trapping Rain Water
   </h1>
   <p>
    Given
    <em>
     n
    </em>
    non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
   </p>
   <p>
    <img src="https://assets.leetcode.com/uploads/2018/10/22/rainwatertrap.png" style="width: 412px; height: 161px;">
    <br>
    <small>
     The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1,2,1]. In this case, 6 units of rain water (blue section) are being trapped.
     <strong>
      Thanks Marcos
     </strong>
     for contributing this image!
    </small>
   </p>
   <p>
    <strong>
     Example:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> [0,1,0,2,1,0,1,3,2,1,2,1]
<strong>Output:</strong> 6</pre>
  </div>
  <div>
   <h1 class="question_title">
    42. 接雨水
   </h1>
   <p>
    给定&nbsp;
    <em>
     n
    </em>
    个非负整数表示每个宽度为 1 的柱子的高度图，计算按此排列的柱子，下雨之后能接多少雨水。
   </p>
   <p>
    <img src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2018/10/22/rainwatertrap.png" style="height: 161px; width: 412px;">
   </p>
   <p>
    <small>
     上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,1] 表示的高度图，在这种情况下，可以接 6 个单位的雨水（蓝色部分表示雨水）。&nbsp;
     <strong>
      感谢 Marcos
     </strong>
     贡献此图。
    </small>
   </p>
   <p>
    <strong>
     示例:
    </strong>
   </p>
   <pre><strong>输入:</strong> [0,1,0,2,1,0,1,3,2,1,2,1]
<strong>输出:</strong> 6</pre>
  </div>
 </body>
</html>